package at.ac.univie.zsu.aguataplan.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;

@Entity
public class Training extends Tournament {

	@NotNull
	@Column
	private String trainingContent;

	@OneToMany(cascade = CascadeType.ALL)
	private Set<Trains> refTrains = new HashSet<Trains>();

	// ----------------------------------------------------
	// CONSTRUCTOR
	// ----------------------------------------------------

	public Training() {

	}

	// ----------------------------------------------------
	// METHODS
	// ----------------------------------------------------

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("CalDate: ").append(getCalDate()).append(", ");
		sb.append("Description: ").append(getDescription()).append(", ");
		sb.append("Id: ").append(getId()).append(", ");
		sb.append("RefTournamentLocation: ").append(getRefTournamentLocation())
				.append(", ");
		sb.append("RefTrains: ")
				.append(getRefTrains() == null ? "null" : getRefTrains().size())
				.append(", ");
		sb.append("RefVideo: ")
				.append(getRefVideo() == null ? "null" : getRefVideo().size())
				.append(", ");
		sb.append("TrainingContent: ").append(getTrainingContent())
				.append(", ");
		sb.append("Version: ").append(getVersion());
		return sb.toString();
	}

	// ----------------------------------------------------
	// METHODS
	// ----------------------------------------------------

	public String getTrainingContent() {
		return trainingContent;
	}

	public void setTrainingContent(String trainingContent) {
		this.trainingContent = trainingContent;
	}

	public Set<Trains> getRefTrains() {
		return refTrains;
	}

	public void setRefTrains(Set<Trains> refTrains) {
		this.refTrains = refTrains;
	}

}
